<template>
  <view class="order-detail-container">
    <status-bar bgColor="#0088ff"></status-bar>
    <!-- 顶部导航栏 -->
    <view class="nav-bar">
      <view class="back-btn" @click="goBack">
        <image src="/static/images/icon/backward_flat.png" class="back-icon-img"></image>
      </view>
      <view class="nav-title">订单详情</view>
    </view>
    
    <!-- 订单信息卡片 -->
    <view class="order-info-card">
      <!-- 派单和预约时间 -->
      <view class="time-info">
        <view class="time-item" v-if="false">
          <text class="time-label">派单时间：</text>
          <text class="time-value">{{orderInfo.dispatchTime || ''}}</text>
        </view>
        <view class="time-item">
          <text class="time-label">预约时间：</text>
          <text class="time-value">{{orderInfo.reservationTime || ''}}</text>
        </view>
        
        <!-- 特殊情况提示 -->
        <view class="special-notice" v-if="orderInfo.status === '待服务'">
          <text class="notice-text">如特殊情况需要修改时间，必须与业主确认后，立即修改预约时间。</text>
        </view>
        
        <!-- 签到时间 -->
        <view class="time-item" v-if="orderInfo.signInTime">
          <text class="time-label">签到时间：</text>
          <text class="time-value">{{orderInfo.signInTime}}</text>
          <text class="sign-status" v-if="orderInfo.isLate">迟到</text>
        </view>
        
        <!-- 备注信息 -->
        <view class="remark-item" v-if="orderInfo.orderNotes">
          <text class="remark-label">备注信息：</text>
          <text class="remark-value special-text">{{orderInfo.orderNotes}}</text>
        </view>

        <!-- 操作按钮 -->
        <view class="quick-action-buttons"  v-if="orderInfo.status === '待服务'">
          <view class="quick-action-btn" @click="signIn" v-if="orderInfo.status === '待服务' && !orderInfo.signInTime">
            <text>签到</text>
          </view>
          <view class="quick-action-btn" @click="modifyAppointmentTime" v-if="orderInfo.status === '待服务' && !orderInfo.signInTime">
            <text>修改时间</text>
          </view>
         <!-- <view class="quick-action-btn" @click="openServiceExceptionModal" v-if="orderInfo.status === '待服务' ">
            <text>服务异常</text>
          </view> -->
        </view>
        
      </view>
    </view>
    
    <!-- 订单基本信息卡片 -->
    <view class="order-base-card">
      <view class="order-item">
        <text class="order-label">订单编号：</text>
        <text class="order-value">{{orderInfo.orderNo}}</text>
        <view class="copy-btn" @click="copyOrderNo">复制订单</view>
      </view>
      
      <view class="order-item">
        <text class="order-label">订单类型：</text>
        <text class="order-value">{{orderInfo.orderType}}</text>
      </view>
      
      <view class="order-item" v-if="false">
        <text class="order-label">测量项目：</text>
        <text class="order-value">{{orderInfo.measureItem}}</text>
      </view>
      
      <view class="order-item">
        <text class="order-label">订单费用：</text>
        <text class="order-price">¥ {{orderInfo.masterOrderFee}}</text>
         <text class="fee-detail" v-if="orderInfo.masterSubsidy>0">（含补贴费：¥ {{orderInfo.masterSubsidy}}）</text> 
      </view>

      
    </view>
    
    
    
    <!-- 客户信息卡片 -->
    <view class="customer-card">
      <view class="card-header">
        <text class="card-title">客户信息</text>
		<view class="copy-btn" @click="copyCustomerInfo()">复制</view>
      </view>
      
      <view class="customer-info">
        <view class="info-item">
          <text class="info-label">姓名：</text>
          <text class="info-value">{{orderInfo.customerName}}</text>
        </view>
        
        <view class="info-item">
          <text class="info-label">电话：</text>
          <text class="info-value">{{orderInfo.customerPhone}}</text>
          <view class="call-btn" @click="callCustomer">拨打</view>
        </view>
        
        <view class="info-item">
          <text class="info-label">地址：</text>
          <text class="info-value">{{orderInfo.customerAddress}}</text>
        </view>
        
        <!-- <view class="map-container" v-if="showMap">
          <map class="location-map" :latitude="mapInfo.latitude" :longitude="mapInfo.longitude" :markers="mapInfo.markers" scale="16"></map>
          <view class="map-actions">
            <view class="map-btn navigate-btn" @click="navigateToLocation">导航</view>
          </view>
        </view> -->
      </view>
    </view>

    <!-- 数据统计展示 -->
    <view class="data-statistics-card">
      <view class="statistics-header">
        <text class="statistics-title">{{orderInfo.orderType === '窗帘测量' ? '测量数据' : '安装数据'}}</text>
        <view class="statistics-summary" @click="viewDataDetails">
          <text class="summary-text">共{{dataStatistics.totalCount}}个{{dataStatistics.unit}}，查看数据</text>
          <image src="/static/images/icon/arrow_right.png" class="arrow-icon"></image>
        </view>
      </view>
    </view>
    
    <!-- 操作按钮区域 -->
    <view class="action-buttons" v-if="showActionButtons">
      <block v-if="orderInfo.status === '待预约'">
        <button class="action-btn primary-btn" @click="goToAppointment">预约上门</button>
      </block>
    <!--  <block v-if="orderInfo.status === '待服务'">
        <button class="action-btn primary-btn" @click="signIn">签到</button>
        <button class="action-btn secondary-btn" @click="reportException">异常上报</button>
      </block> -->
	  <block v-if="orderInfo.status === '待服务'">
	    <button v-if="false" class="action-btn primary-btn" @click="goToMeasurementRecord">添加数据</button>


	    <button class="action-btn secondary-btn" @click="reportException">申请验收</button>
	  </block>
      <!-- <block v-if="orderInfo.status === '待验收'">
        <button class="action-btn primary-btn" @click="completeOrder">完成订单</button>
      </block> -->
    </view>
    <!-- 服务异常备注弹窗 -->
    <view v-if="showExceptionModal" class="modal-mask">
      <view class="modal-dialog">
        <view class="modal-title">服务异常备注</view>
        <textarea class="modal-textarea" v-model="exceptionRemark" placeholder="请输入异常原因或说明，最多200字" maxlength="200"></textarea>
        <view class="modal-actions">
          <button class="modal-btn cancel" @click="cancelServiceException">取消</button>
          <button class="modal-btn confirm" @click="confirmServiceException">确定</button>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
import { getOrderInfo, editOrder, getOrderDataCount , checkInstallData} from '@/api/app/master/order'


export default {
  data() {
    return {
      orderId: null,
      orderStatus: '',
      showExceptionModal: false,
      exceptionRemark: '',
      orderInfo: {
        reservationTime: '',
        signInTime: '',
        isLate: false,
        orderNotes: '',
        orderNo: '',
        orderType: '窗帘测量',
        measureItem: '普通测量',
        orderFee: '105',
        remoteFee: '30',
        customerName: '张先生',
        customerPhone: '138****1234',
        customerAddress: '广东省广州市天河区天河路385号太古汇1座2301',
        status: '待服务',
        masterOrderFee: '',
    
      },
      showMap: true,
      mapInfo: {
        latitude: 23.125178,
        longitude: 113.327904,
        markers: [{
          id: 1,
          latitude: 23.125178,
          longitude: 113.327904,
          title: '客户位置'
        }]
      },
      showActionButtons: true,
      dataStatistics: {
        totalCount: 3,
        unit: '窗户'
      }
    }
  },
  onLoad(options) {
    // 获取传递过来的订单ID
    if (options.id) {
      this.orderId = options.id;
      // 获取订单详情
      this.getOrderDetail();
      // 查询订单数据统计
      this.getOrderDataStatistics();
      
    } else {
      uni.showToast({
        title: '订单ID不存在',
        icon: 'none'
      });
      setTimeout(() => {
        uni.navigateBack();
      }, 1500);
    }
  },
  methods: {
    // 打开服务异常备注弹窗
    openServiceExceptionModal() {
      this.exceptionRemark = '';
      this.showExceptionModal = true;
    },
    // 取消弹窗
    cancelServiceException() {
      this.showExceptionModal = false;
      this.exceptionRemark = '';
    },
    // 确认并调用服务异常
    confirmServiceException() {
      const remark = (this.exceptionRemark || '').trim();
      if (!remark) {
        uni.showToast({ title: '请输入异常备注', icon: 'none' });
        return;
      }
      this.showExceptionModal = false;
      // 如果 serviceException 需要备注参数，则传入
      if (typeof this.serviceException === 'function') {
        try {
          this.serviceException(remark);
        } catch (e) {
          // 回退到不带参调用
          this.serviceException();
        }
      }
    },
    // 获取订单数据统计
    getOrderDataStatistics() {
      getOrderDataCount(this.orderId)
        .then(res => {
          if (res.code === 200) {
            // 处理数据统计
            this.dataStatistics = {
              totalCount: res.data || 0,
              unit: '窗户'
            };
          } else {
            console.error('获取数据统计失败:', res.msg);
            // 使用默认值
            this.dataStatistics = {
              totalCount: 0,
              unit: '窗户'
            };
          }
        })
        .catch(err => {
          console.error('获取数据统计失败:', err);
          // 使用默认值
          this.dataStatistics = {
            totalCount: 0,
            unit: '窗户'
          };
        });
    },
    
    // 获取订单详情
    getOrderDetail() {
      uni.showLoading({
        title: '加载中...'
      });
      
      getOrderInfo(this.orderId)
        .then(res => {
          if (res.code === 200) {
            // 处理订单数据
            this.processOrderData(res.data);
          } else {
            uni.showToast({
              title: res.msg || '获取订单详情失败',
              icon: 'none'
            });
          }
        })
        .catch(err => {
          console.error('获取订单详情失败:', err);
          uni.showToast({
            title: '获取订单详情失败',
            icon: 'none'
          });
        })
        .finally(() => {
          uni.hideLoading();
        });
    },
    
    // 处理订单数据
    processOrderData(data) {
      if (!data) return;
      
      // 格式化预约时间
      this.orderStatus = data.orderStatus;
      let formattedReservationTime = '';
      if (data.reservationTime) {
        const dateTime = new Date(data.reservationTime);
        if (!isNaN(dateTime.getTime())) {
          const year = dateTime.getFullYear();
          const month = (dateTime.getMonth() + 1).toString().padStart(2, '0');
          const day = dateTime.getDate().toString().padStart(2, '0');
          const hours = dateTime.getHours().toString().padStart(2, '0');
          const minutes = dateTime.getMinutes().toString().padStart(2, '0');
          
          // 获取星期几
          const weekDays = ['日', '一', '二', '三', '四', '五', '六'];
          const weekDay = weekDays[dateTime.getDay()];
          
          formattedReservationTime = `${year}-${month}-${day}[周${weekDay}]${hours}:${minutes}`;
        } else {
          formattedReservationTime = data.reservationTime;
        }
      }
      
      // 格式化签到时间
      let formattedSignInTime = '';
      if (data.signInTime) {
        const dateTime = new Date(data.signInTime);
        if (!isNaN(dateTime.getTime())) {
          const year = dateTime.getFullYear();
          const month = (dateTime.getMonth() + 1).toString().padStart(2, '0');
          const day = dateTime.getDate().toString().padStart(2, '0');
          const hours = dateTime.getHours().toString().padStart(2, '0');
          const minutes = dateTime.getMinutes().toString().padStart(2, '0');
          
          // 获取星期几
          const weekDays = ['日', '一', '二', '三', '四', '五', '六'];
          const weekDay = weekDays[dateTime.getDay()];
          
          formattedSignInTime = `${year}-${month}-${day}[周${weekDay}]${hours}:${minutes}`;
        } else {
          formattedSignInTime = data.signInTime;
        }
      }
      
      // 这里根据实际接口返回的数据结构进行处理
      this.orderInfo = {
        masterOrderFee: data.masterOrderFee || '',
        dispatchTime: data.dispatchTime || '',
        reservationTime: formattedReservationTime,
        signInTime: formattedSignInTime,
        isLate: data.isLate || false,
        orderNotes: data.orderNotes || '',
        orderNo: data.orderNo || '',
        orderType: data.orderType === '1' || data.orderType === 1 ? '窗帘测量' : '窗帘安装',
        measureItem: data.measureItem || '普通测量',
        orderFee: data.orderFee || '0',
        remoteFee: data.remoteFee || '0',
        customerName: data.ownerName || '',
        customerPhone: data.ownerPhone || '',
        customerAddress: (data.ownerProvincial || '') + 
                        (data.ownerCity || '') + 
                        (data.ownerCounty || '') + 
                        (data.ownerAddress || ''),
        status: this.getStatusText(data.orderStatus),
        orderSource : data.orderSource || '',
        masterSubsidy: data.masterSubsidy || '',
      };
      
      // 设置地图信息
      if (data.latitude && data.longitude) {
        this.mapInfo.latitude = data.latitude;
        this.mapInfo.longitude = data.longitude;
        this.mapInfo.markers = [{
          id: 1,
          latitude: data.latitude,
          longitude: data.longitude,
          title: '客户位置'
        }];
        this.showMap = true;
      } else {
        this.showMap = false;
      }
    },
    
    // 获取订单状态文本
    getStatusText(status) {
      const statusMap = {
        '1': '待派单',
        '2': '待预约',
        '3': '待服务',
        '4': '待验收',
        '5': '已完成',
        '9': '已售后',
        '99': '异常订单'
      };
      return statusMap[status] || '未知状态';
    },
    
    // 返回上一页
    goBack() {
      uni.navigateBack();
    },
    
    // 复制订单号
    copyOrderNo() {
      uni.setClipboardData({
        data: this.orderInfo.orderNo,
        success: () => {
          uni.showToast({
            title: '订单号已复制',
            icon: 'success'
          });
        }
      });
    },
	
	// 复制客户信息
	copyCustomerInfo() {
	  const result = `姓名：${this.orderInfo.customerName}\n电话：${this.orderInfo.customerPhone}\n地址：${this.orderInfo.customerAddress}`;
	  uni.setClipboardData({
	    data: result,
	    success: () => {
	      uni.showToast({
	        title: '客户信息已复制',
	        icon: 'success'
	      });
	    }
	  });
	},
    
    // 拨打客户电话
    callCustomer() {
      const phoneNumber = this.orderInfo.customerPhone.replace(/\*+/g, ''); // 移除电话号码中的星号
      
      uni.showModal({
        title: '拨打电话',
        content: `确定要拨打 ${this.orderInfo.customerPhone} 电话吗？`,
        success: (res) => {
          if (res.confirm) {
            uni.makePhoneCall({
              phoneNumber: phoneNumber,
              fail: () => {
                uni.showToast({
                  title: '拨打电话失败',
                  icon: 'none'
                });
              }
            });
          }
        }
      });
    },
    
    // 导航到客户位置
    navigateToLocation() {
      if (!this.mapInfo.latitude || !this.mapInfo.longitude) {
        uni.showToast({
          title: '无法获取客户位置信息',
          icon: 'none'
        });
        return;
      }
      
      uni.openLocation({
        latitude: this.mapInfo.latitude,
        longitude: this.mapInfo.longitude,
        name: this.orderInfo.customerName,
        address: this.orderInfo.customerAddress,
        fail: () => {
          uni.showToast({
            title: '打开导航失败',
            icon: 'none'
          });
        }
      });
    },
    
    // 前往预约页面
    goToAppointment() {
      uni.navigateTo({
        url: `/pages/order/order-appointment?id=${this.orderId}`
      });
    },
    
    // 签到
    signIn() {
      uni.showModal({
        title: '签到确认',
        content: '确定要进行签到操作吗？',
        success: (res) => {
          if (res.confirm) {
            // 这里调用签到接口
            const  appointmentData = {
                  id: this.orderId,
                  orderStatus: '3',
                  operateType: 9
                };
            editOrder(appointmentData).then(res => {
              if (res.code === 200) {
                 uni.showLoading({
                     title: '签到中...'
                  });
            setTimeout(() => {
              uni.hideLoading();
              uni.showToast({
                title: '签到成功',
                icon: 'success'
              });
              // 刷新订单详情
              this.getOrderDetail();
            }, 500);
              }
            }).catch(err => {
              console.error(err);
                uni.showToast({
                title: '签到失败，请稍后重试',
                icon: 'none'
              });
            });

           
          }
        }
      });
    },
    
    // 修改预约时间
    modifyAppointmentTime() {
      uni.navigateTo({
        url: `/pages/order/order-appointment?id=${this.orderId}&isModify=true`
      });
    },
    
    // 服务异常：提交异常备注并更新订单状态为异常订单
    serviceException(remark){
      const reason = (remark || '').trim();
      if (!reason) {
        uni.showToast({ title: '请输入异常备注', icon: 'none' });
        return;
      }
      const appointmentData = {
        id: this.orderId,
        orderStatus: '99', // 异常订单
        operateType: 8,    // 按既有约定：异常操作类型
        reason: reason
      };
      uni.showLoading({ title: '提交中...' });
      editOrder(appointmentData).then(res => {
        uni.hideLoading();
        if (res.code === 200) {
          uni.showToast({ title: '提交成功', icon: 'success' });
          // 返回并刷新上页列表，或在当前页刷新详情
          setTimeout(() => {
            uni.navigateBack();
          }, 500);
        } else {
          uni.showToast({ title: res.msg || '提交失败，请稍后重试', icon: 'none' });
        }
      }).catch(err => {
        uni.hideLoading();
        console.error(err);
        uni.showToast({ title: '提交失败，请稍后重试', icon: 'none' });
      });
    },

    
    // 申请验收 
    reportException() {
      
      if (!this.orderInfo.signInTime) {
                    uni.showToast({
                        title: '请先进行签到后再申请验收',
                        icon: 'none'
                      });
        return;
      }







      // 验证安装订单数据是否上传了图片
      //  if (this.orderInfo.orderType === '窗帘安装'){  
        if(this.orderSource == '2'){
checkInstallData(this.orderId).then(res => {
            if (res.code === 200) {
               
                      const  appointmentData = {
                          id: this.orderId,
                          orderStatus: '4',
                          operateType: 10
                        };
                    editOrder(appointmentData).then(res => {
                      if (res.code === 200) {
                        uni.showLoading({
                            title: '提交中...'
                          });
                    setTimeout(() => {
                      uni.hideLoading();
                      uni.showToast({
                        title: '申请成功',
                        icon: 'success'
                      });
                      // 刷新订单详情
                      uni.navigateBack();

                    }, 500);
                      }
                    }).catch(err => {
                      console.error(err);
                        uni.showToast({
                        title: '提交失败，请稍后重试',
                        icon: 'success'
                      });
                    });     

            } else {
              uni.showToast({
                title: res.msg ,
                icon: 'none'
              });
             
            }
          });
        }else{
              const  appointmentData = {
                          id: this.orderId,
                          orderStatus: '4',
                          operateType: 10
                        };
                    editOrder(appointmentData).then(res => {
                      if (res.code === 200) {
                        uni.showLoading({
                            title: '提交中...'
                          });
                    setTimeout(() => {
                      uni.hideLoading();
                      uni.showToast({
                        title: '申请成功',
                        icon: 'success'
                      });
                      // 刷新订单详情
                      uni.navigateBack();

                    }, 500);
                      }
                    }).catch(err => {
                      console.error(err);
                        uni.showToast({
                        title: '提交失败，请稍后重试',
                        icon: 'none'
                      });
                    });  
        }

          
      //  }

      


      // 这里调用签到接口
            

    },
	// 前往测量记录
	goToMeasurementRecord() {
	  uni.navigateTo({
	    url: '/pages/order/measurement-record'
	  });
	},
    
    // 查看数据详情
    viewDataDetails() {
      if (this.orderInfo.orderType === '窗帘测量') {
        // 跳转到测量数据页面
        uni.navigateTo({
          url: `/pages/order/measurement-record?orderId=${this.orderId}&orderNo=${this.orderInfo.orderNo}&orderStatus=${this.orderStatus}`
        });
      } else {
        // 跳转到安装数据页面
        uni.navigateTo({
          url: `/pages/order/installation-data?orderId=${this.orderId}`
        });
      }
    },
    
    // 完成订单
    completeOrder() {
      uni.showModal({
        title: '完成订单',
        content: '确定要完成此订单吗？',
        success: (res) => {
          if (res.confirm) {
            // 这里调用完成订单接口
            uni.showLoading({
              title: '处理中...'
            });
            
            setTimeout(() => {
              uni.hideLoading();
              uni.showToast({
                title: '订单已完成',
                icon: 'success'
              });
              
              // 返回订单列表页
              setTimeout(() => {
                uni.switchTab({
                  url: '/pages/index/work'
                });
              }, 1500);
            }, 1000);
          }
        }
      });
    }
  }
}
</script>

<style lang="scss" scoped>
.order-detail-container {
  min-height: 100vh;
  background-color: #f5f5f5;
  padding-bottom: 30rpx;
}

/* 顶部导航栏 */
.nav-bar {
  display: flex;
  align-items: center;
  height: 90rpx;
  background-color: #0088ff;
  color: #fff;
  padding: 0 30rpx;
  position: relative;
}

.back-btn {
  position: absolute;
  left: 30rpx;
  display: flex;
  align-items: center;
  justify-content: center;
}

.back-icon-img {
  width: 40rpx;
  height: 40rpx;
}

.nav-title {
  flex: 1;
  text-align: center;
  font-size: 36rpx;
  font-weight: bold;
}

/* 订单信息卡片 */
.order-info-card, .order-base-card, .customer-card, .data-statistics-card {
  background-color: #fff;
  margin: 20rpx;
  border-radius: 10rpx;
  padding: 20rpx;
  box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
}

.time-info {
  padding: 10rpx 0;
}

.time-item, .remark-item {
  display: flex;
  align-items: center;
  margin-bottom: 15rpx;
  flex-wrap: wrap;
}

.time-label, .remark-label {
  color: #666;
  font-size: 28rpx;
  min-width: 160rpx;
}

.time-value, .remark-value {
  color: #333;
  font-size: 28rpx;
  font-weight: bold;
}

.special-text {
  color: #ff8c00;
}

.sign-status {
  color: #ff3b30;
  font-size: 28rpx;
  margin-left: 20rpx;
  font-weight: bold;
}

.special-notice {
  background-color: #fff9e6;
  padding: 15rpx;
  border-radius: 8rpx;
  margin: 10rpx 0 20rpx;
}

.notice-text {
  color: #ff8c00;
  font-size: 26rpx;
  line-height: 1.5;
}

/* 订单基本信息 */
.order-item {
  display: flex;
  align-items: center;
  margin-bottom: 15rpx;
  flex-wrap: wrap;
}

.order-label {
  color: #666;
  font-size: 28rpx;
  min-width: 160rpx;
}

.order-value {
  color: #333;
  font-size: 28rpx;
  flex: 1;
}

.order-price {
  color: #ff3b30;
  font-size: 32rpx;
  font-weight: bold;
}

.fee-detail {
  color: #181818;
  font-size: 24rpx;
  margin-left: 20rpx;
}

.copy-btn {
  background-color: #f0f0f0;
  color: #666;
  font-size: 24rpx;
  padding: 6rpx 16rpx;
  border-radius: 30rpx;
}

/* 客户信息卡片 */
.card-header {
  border-bottom: 1rpx solid #f0f0f0;
  padding-bottom: 15rpx;
  margin-bottom: 20rpx;
  display: flex;
  justify-content: space-between;
  align-items: center; 
}

.card-title {
  font-size: 30rpx;
  font-weight: bold;
  color: #333;
}

.customer-info {
  padding: 10rpx 0;
}

.info-item {
  display: flex;
  align-items: center;
  margin-bottom: 15rpx;
  flex-wrap: wrap;
}

.info-label {
  color: #666;
  font-size: 28rpx;
  min-width: 100rpx;
}

.info-value {
  color: #333;
  font-size: 28rpx;
  flex: 1;
}

.call-btn {
  background-color: #0088ff;
  color: #fff;
  font-size: 24rpx;
  padding: 6rpx 20rpx;
  border-radius: 30rpx;
}

/* 地图容器 */
.map-container {
  width: 100%;
  height: 300rpx;
  margin-top: 20rpx;
  position: relative;
  border-radius: 10rpx;
  overflow: hidden;
}

.location-map {
  width: 100%;
  height: 100%;
}

.map-actions {
  position: absolute;
  bottom: 20rpx;
  right: 20rpx;
  display: flex;
}

.map-btn {
  background-color: #fff;
  color: #0088ff;
  font-size: 24rpx;
  padding: 10rpx 20rpx;
  border-radius: 30rpx;
  box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.1);
  margin-left: 10rpx;
}

.navigate-btn {
  background-color: #0088ff;
  color: #fff;
}

/* 快速操作按钮 */
.quick-action-buttons {
  display: flex;
  justify-content: space-around;
  margin: 5rpx 0;
  padding: 10rpx 0;
  border: 1px solid #f0f0f0;
  border-radius: 10rpx;
}

.quick-action-btn {
  flex: 1;
  height: 70rpx;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28rpx;
  color: #0088ff;
  position: relative;
}

.quick-action-btn:not(:last-child)::after {
  content: '';
  position: absolute;
  right: 0;
  top: 15rpx;
  height: 40rpx;
  width: 1px;
  background-color: #e0e0e0;
}

/* 操作按钮区域 */
.action-buttons {
  display: flex;
  justify-content: space-around;
  padding: 30rpx 20rpx;
}

.action-btn {
  min-width: 300rpx;
  height: 80rpx;
  line-height: 80rpx;
  text-align: center;
  border-radius: 40rpx;
  font-size: 30rpx;
  margin: 0 10rpx;
}

.primary-btn {
  background-color: #0088ff;
  color: #fff;
}

.secondary-btn {
  background-color: #fff;
  color: #0088ff;
  border: 1rpx solid #0088ff;
}

/* 数据统计卡片 */
.data-statistics-card {
  margin-bottom: 20rpx;
}

.statistics-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10rpx 0;
}

.statistics-title {
  font-size: 30rpx;
  font-weight: bold;
  color: #333;
}

.statistics-summary {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.summary-text {
  font-size: 28rpx;
  color: #ff6b35;
  margin-right: 10rpx;
}

.arrow-icon {
  width: 24rpx;
  height: 24rpx;
  opacity: 0.6;
}
.modal-mask {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  background: rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}
.modal-dialog {
  width: 86%;
  background: #fff;
  border-radius: 12rpx;
  padding: 20rpx;
}
.modal-title {
  font-size: 30rpx;
  font-weight: bold;
  color: #333;
  margin-bottom: 15rpx;
}
.modal-textarea {
  width: 100%;
  min-height: 180rpx;
  border: 2rpx solid #e0e0e0;
  border-radius: 8rpx;
  font-size: 26rpx;
  padding: 16rpx;
  background: #fff;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 20rpx;
}
.modal-btn {
  min-width: 160rpx;
  height: 64rpx;
  line-height: 64rpx;
  text-align: center;
  border-radius: 8rpx;
  font-size: 28rpx;
  margin-left: 12rpx;
}
.modal-btn.cancel {
  background: #f5f5f5;
  color: #666;
}
.modal-btn.confirm {
  background: #0088ff;
  color: #fff;
}
</style>